<template>
  <editor-layout class="detail" :show-ok-btn="false" cancel-text="关闭" v-on="$listeners" v-loading="loading" :loading="saveLoading">
    <form-detail :data="model" :columns="columns" :cols="2" border :gutter="0">
      <template v-slot:sex_content>
        <tag-sex :value="model.sex"/>
      </template>

      <template v-slot:status_content>
        <el-switch
          v-model="model.status"
          active-text="正常"
          inactive-text="禁用"
          active-color="#13ce66"
          inactive-color="#ff4949"
          active-value="1"
          inactive-value="0"
          disabled>
        </el-switch>
      </template>

      <template v-slot:billing_content>
        <card-format :value="model.billing" />
      </template>

      <template v-slot:bankCard_content>
        <card-format :value="model.bankCard" />
      </template>
    </form-detail>
  </editor-layout>
</template>

<script>
import {getSysTuserInfoUserId} from '$my/code/api/t-user'
/**
 * Created by Administrator on 2021/8/6
 */

export default {
  name: 'detail',
  props: {
    id: String
  },
  data() {
    return {
      loading: false,
      saveLoading: false,
      model: {
      },
      columns: [
        {prop: 'username', label: '客户姓名'},
        {prop: 'mobile', label: '手机号'},
        {prop: 'email', label: '邮箱'},
        {prop: 'sex', label: '性别'},
        {prop: 'address', label: '地址'},
        {prop: 'billing', label: '信用代码'},
        {prop: 'bank', label: '开户行'},
        {prop: 'bankCard', label: '开户行卡号'},
        {prop: 'status', label: '状态'}
      ]
    }
  },
  methods: {
    init() {
      this.loading = true
      getSysTuserInfoUserId(this.id).then(res => {
        this.loading = false
        this.model = {...res}
      }).catch(e => {
        console.error(e)
        this.loading = false
      })
    }
  },
  mounted() {
    this.init()
  }
}
</script>

<style lang="scss" scoped>
.detail {
}
</style>
